<!DOCTYPE HTML>
<!--generated with sswg-->
<html lang="en">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<head>
    <title>GridEditor</title>
    <link rel="stylesheet" href="../sswg.css">
    <link rel="stylesheet" href="../style.css">
    <link rel="icon" type="image/x-icon" href="favicon.ico">
</head>
<body>
<div style="max-width:1200px; margin:auto;">
<div style="text-align:left;">
<h1 id="GridEditor">
GridEditor
</h1><gray>&lt;/&gt;</gray><a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py"> ursina.prefabs.grid_editor</a><br>
<gray>Inherits</gray> <a href="entity.html">Entity</a><br>
<br>
<h2 id="Initialization">
Initialization
</h2><code_block id="code_block_0"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_0)">copy</button>GridEditor(size=(<yellow>3</yellow><yellow>2</yellow>, <yellow>3</yellow><yellow>2</yellow>), palette=(<green>' '</green>, <green>'<gray>#'</green>, <green>'|'</green>, <green>'o'</green>), canvas_<olive>color</olive>=color.white, edit_<olive>mode</olive>=True)</gray>
</code_block>
<br>
<h2 id="Attributes">
Attributes
</h2><h3 id=".canvas">
.canvas
</h3><gray>default: </gray><span>Entity(parent=self, model='quad', origin=(-0.5, -0...</span><br>
<hr></hr><br>
<h3 id=".canvas_collider">
.canvas_collider
</h3><gray>default: </gray><span>Entity(parent=self.canvas, model='wireframe_quad',...</span><br>
<hr></hr><br>
<h3 id=".brush_size">
.brush_size
</h3><gray>default: </gray><span>1</span><br>
<hr></hr><br>
<h3 id=".auto_render">
.auto_render
</h3><gray>default: </gray><span>True</span><br>
<hr></hr><br>
<h3 id=".gizmo_parent">
.gizmo_parent
</h3><gray>default: </gray><span>Entity(parent=self.canvas, scale=(1 / self.w, 1 / ...</span><br>
<hr></hr><br>
<h3 id=".cursor">
.cursor
</h3><gray>default: </gray><span>Entity(parent=self.gizmo_parent)</span><br>
<hr></hr><br>
<h3 id=".cursor_graphics">
.cursor_graphics
</h3><gray>default: </gray><span>Entity(parent=self.cursor, model=Quad(segments=0, ...</span><br>
<hr></hr><br>
<h3 id=".selected_char">
.selected_char
</h3><gray>default: </gray><span>palette[1]</span><br>
<hr></hr><br>
<h3 id=".start_pos">
.start_pos
</h3><gray>default: </gray><span>None</span><br>
<hr></hr><br>
<h3 id=".prev_draw">
.prev_draw
</h3><gray>default: </gray><span>None</span><br>
<hr></hr><br>
<h3 id=".lock_axis">
.lock_axis
</h3><gray>default: </gray><span>None</span><br>
<hr></hr><br>
<h3 id=".outline">
.outline
</h3><gray>default: </gray><span>Entity(parent=self.canvas, model=Quad(segments=0, ...</span><br>
<hr></hr><br>
<h3 id=".selection_renderer">
.selection_renderer
</h3><gray>default: </gray><span>Entity(parent=self.gizmo_parent, model=Mesh(mode='...</span><br>
<hr></hr><br>
<h3 id=".rect_selection">
.rect_selection
</h3><gray>default: </gray><span>[Vec2(0, 0), Vec2(0, 0)]</span><br>
<hr></hr><br>
<h3 id=".rect_tool">
.rect_tool
</h3><gray>default: </gray><span>Entity(parent=self.gizmo_parent, model=Quad(0, mod...</span><br>
<hr></hr><br>
<h3 id=".selection_matrix">
.selection_matrix
</h3><gray>default: </gray><span>[[0 for y in range(self.h)] for x in range(self.w)...</span><br>
<hr></hr><br>
<h3 id=".temp_paste_layer">
.temp_paste_layer
</h3><gray>default: </gray><span>Entity(parent=self.cursor, model='quad', origin=(-...</span><br>
<hr></hr><br>
<h3 id=".is_in_paste_mode">
.is_in_paste_mode
</h3><gray>default: </gray><span>False</span><br>
<hr></hr><br>
<h3 id=".undo_stack">
.undo_stack
</h3><gray>default: </gray><span>[]</span><br>
<hr></hr><br>
<h3 id=".undo_index">
.undo_index
</h3><gray>default: </gray><span>0</span><br>
<hr></hr><br>
<h3 id=".shortcuts">
.shortcuts
</h3><gray>default: </gray><span>{'draw': 'left mouse', 'sample_modifier': 'alt', '...</span><br>
<hr></hr><br>
<h3 id=".help_icon">
.help_icon
</h3><gray>default: </gray><span>Button(parent=self.canvas, scale=0.025, model='cir...</span><br>
<hr></hr><br>
<h3 id=".grid">
.grid
</h3><gray>default: </gray><span>Array2D(self.w, self.h, default_value=palette[0])</span><br>
<hr></hr><br>
<br>
<br>
<h2 id="Properties">
Properties
</h2><h3 id="palette">
palette
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L90" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#palette_setter" onclick="navigator.clipboard.writeText('#palette_setter')" title="Copy permalink">◃-</a></div><hr></hr><br>
<h3 id="edit_mode">
edit_mode
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L113" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#edit_mode_setter" onclick="navigator.clipboard.writeText('#edit_mode_setter')" title="Copy permalink">◃-</a></div><hr></hr><br>
<h2 id="Methods">
Methods
</h2><h3 id="update()">
update()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L120" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#update" onclick="navigator.clipboard.writeText('#update')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="get_cursor_position()">
get_cursor_position()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L222" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#get_cursor_position" onclick="navigator.clipboard.writeText('#get_cursor_position')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="draw()">
draw()
</h3><code_block id="code_block_1"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_1)">copy</button>draw(x=None, <olive>y</olive>=None)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L228" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#draw" onclick="navigator.clipboard.writeText('#draw')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="render()">
render()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L237" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#render" onclick="navigator.clipboard.writeText('#render')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="sample()">
sample()
</h3><code_block id="code_block_2"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_2)">copy</button>sample(x=None, <olive>y</olive>=None)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L241" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#sample" onclick="navigator.clipboard.writeText('#sample')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="input()">
input()
</h3><code_block id="code_block_3"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_3)">copy</button>input(ke<olive>y</olive>=None)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L245" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#input" onclick="navigator.clipboard.writeText('#input')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="undo()">
undo()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L354" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#undo" onclick="navigator.clipboard.writeText('#undo')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="redo()">
redo()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L360" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#redo" onclick="navigator.clipboard.writeText('#redo')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="record_undo()">
record_undo()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L366" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#record_undo" onclick="navigator.clipboard.writeText('#record_undo')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="floodfill()">
floodfill()
</h3><code_block id="code_block_4"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_4)">copy</button>floodfill(matrix=None, x=None, <olive>y</olive>=None, first=True)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L373" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#floodfill" onclick="navigator.clipboard.writeText('#floodfill')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="copy()">
copy()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L392" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#copy" onclick="navigator.clipboard.writeText('#copy')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="cut()">
cut()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L418" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#cut" onclick="navigator.clipboard.writeText('#cut')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="enter_paste_mode()">
enter_paste_mode()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L427" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#enter_paste_mode" onclick="navigator.clipboard.writeText('#enter_paste_mode')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="update_paste_texture()">
update_paste_texture()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L454" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#update_paste_texture" onclick="navigator.clipboard.writeText('#update_paste_texture')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="paste()">
paste()
</h3><code_block id="code_block_5"><button class="copy_code_button" onclick="copy_to_clipboard(code_block_5)">copy</button>paste(discard=False, record_undo=True)
</code_block>
<div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L460" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#paste" onclick="navigator.clipboard.writeText('#paste')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="flip_horizontally()">
flip_horizontally()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L472" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#flip_horizontally" onclick="navigator.clipboard.writeText('#flip_horizontally')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="clear_selection()">
clear_selection()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L477" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#clear_selection" onclick="navigator.clipboard.writeText('#clear_selection')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<h3 id="render_selection()">
render_selection()
</h3><div class="links">  <a href="https://github.com/pokepetter/ursina/tree/v8_0_0/ursina/prefabs/grid_editor.py#L483" alt="Source Code" title="View Source Code" style="font-size:.75em;">&lt;/&gt;</a>  <a href="#render_selection" onclick="navigator.clipboard.writeText('#render_selection')" title="Copy permalink">◃-</a></div><br>
<hr></hr><br>
<br>
<div class="sidebar"><span>8.0.0</span><br>
Basics<br>
  <a href="ursina.html">Ursina</a><br>
  <a href="entity.html">Entity</a><br>
  <a href="button.html">Button</a><br>
  <a href="sprite.html">Sprite</a><br>
  <a href="text.html">Text</a><br>
  <a href="audio.html">Audio</a><br>
<br>
Core Modules<br>
  <a href="camera.html">camera</a><br>
  <a href="mouse.html">mouse</a><br>
  <a href="window.html">window</a><br>
  <a href="application.html">application</a><br>
  <a href="scene.html">scene</a><br>
<br>
Graphics<br>
  <a href="color.html">color</a><br>
  <a href="mesh.html">Mesh</a><br>
  <a href="shader.html">Shader</a><br>
  <a href="texture.html">Texture</a><br>
  <a href="light.html">Light</a><br>
  <a href="directional_light.html">DirectionalLight</a><br>
  <a href="point_light.html">PointLight</a><br>
  <a href="ambient_light.html">AmbientLight</a><br>
  <a href="spot_light.html">SpotLight</a><br>
<br>
Procedural Models<br>
  <a href="quad.html">Quad</a><br>
  <a href="circle.html">Circle</a><br>
  <a href="plane.html">Plane</a><br>
  <a href="grid.html">Grid</a><br>
  <a href="cone.html">Cone</a><br>
  <a href="cylinder.html">Cylinder</a><br>
  <a href="pipe.html">Pipe</a><br>
  <a href="terrain.html">Terrain</a><br>
<br>
modules<br>
  <a href="input_handler.html">input_handler</a><br>
  <a href="mesh_importer.html">mesh_importer</a><br>
  <a href="texture_importer.html">texture_importer</a><br>
  <a href="string_utilities.html">string_utilities</a><br>
<br>
Animation<br>
  <a href="animation.html">Animation</a><br>
  <a href="frame_animation3d.html">FrameAnimation3d</a><br>
  <a href="sprite_sheet_animation.html">SpriteSheetAnimation</a><br>
  <a href="animator.html">Animator</a><br>
  <a href="trail_renderer.html">TrailRenderer</a><br>
  <a href="curve.html">curve</a><br>
<br>
Math<br>
  <a href="ursinamath.html">ursinamath</a><br>
  <a href="vec2.html">Vec2</a><br>
  <a href="vec3.html">Vec3</a><br>
  <a href="vec4.html">Vec4</a><br>
  <a href="cubic_bezier.html">CubicBezier</a><br>
  <a href="array_tools.html">array_tools</a><br>
  <a href="array2_d.html">Array2D</a><br>
  <a href="array3_d.html">Array3D</a><br>
<br>
Gameplay<br>
  <a href="ursinastuff.html">ursinastuff</a><br>
  <a href="sequence.html">Sequence</a><br>
  <a href="func.html">Func</a><br>
  <a href="keys.html">Keys</a><br>
<br>
Collision<br>
  <a href="raycast.html">raycast</a><br>
  <a href="terraincast.html">terraincast</a><br>
  <a href="boxcast.html">boxcast</a><br>
  <a href="hit_info.html">HitInfo</a><br>
  <a href="collider.html">Collider</a><br>
  <a href="box_collider.html">BoxCollider</a><br>
  <a href="sphere_collider.html">SphereCollider</a><br>
  <a href="mesh_collider.html">MeshCollider</a><br>
<br>
Prefabs<br>
  <a href="sky.html">Sky</a><br>
  <a href="editor_camera.html">EditorCamera</a><br>
  <a href="tilemap.html">Tilemap</a><br>
  <a href="first_person_controller.html">FirstPersonController</a><br>
  <a href="platformer_controller2d.html">PlatformerController2d</a><br>
  <a href="conversation.html">Conversation</a><br>
<br>
UI<br>
  <a href="button.html">Button</a><br>
  <a href="draggable.html">Draggable</a><br>
  <a href="tooltip.html">Tooltip</a><br>
  <a href="slider.html">Slider</a><br>
  <a href="thin_slider.html">ThinSlider</a><br>
  <a href="text_field.html">TextField</a><br>
  <a href="input_field.html">InputField</a><br>
  <a href="content_types.html">ContentTypes</a><br>
  <a href="checkbox.html">Checkbox</a><br>
  <a href="button_list.html">ButtonList</a><br>
  <a href="button_group.html">ButtonGroup</a><br>
  <a href="window_panel.html">WindowPanel</a><br>
  <a href="file_browser.html">FileBrowser</a><br>
  <a href="file_browser_save.html">FileBrowserSave</a><br>
  <a href="dropdown_menu.html">DropdownMenu</a><br>
  <a href="radial_menu.html">RadialMenu</a><br>
  <a href="health_bar.html">HealthBar</a><br>
<br>
Editor<br>
  <a href="hot_reloader.html">HotReloader</a><br>
  <a href="grid_editor.html">GridEditor</a><br>
  <a href="pixel_editor.html">PixelEditor</a><br>
  <a href="ascii_editor.html">ASCIIEditor</a><br>
  <a href="color_picker.html">ColorPicker</a><br>
<br>
Scripts<br>
  <a href="grid_layout.html">grid_layout</a><br>
  <a href="duplicate.html">duplicate</a><br>
  <a href="smooth_follow.html">SmoothFollow</a><br>
  <a href="scrollable.html">Scrollable</a><br>
  <a href="noclip_mode.html">NoclipMode</a><br>
  <a href="noclip_mode2d.html">NoclipMode2d</a><br>
  <a href="build.html">build</a><br>
<br>
Assets<br>
  <a href="models.html">models</a><br>
  <a href="textures.html">textures</a><br>
<br>
Shaders<br>
  <a href="unlit_shader.html">unlit_shader</a><br>
  <a href="lit_with_shadows_shader.html">lit_with_shadows_shader</a><br>
  <a href="matcap_shader.html">matcap_shader</a><br>
  <a href="colored_lights_shader.html">colored_lights_shader</a><br>
  <a href="fresnel_shader.html">fresnel_shader</a><br>
  <a href="projector_shader.html">projector_shader</a><br>
  <a href="texture_blend_shader.html">texture_blend_shader</a><br>
  <a href="instancing_shader.html">instancing_shader</a><br>
  <a href="triplanar_shader.html">triplanar_shader</a><br>
  <a href="normals_shader.html">normals_shader</a><br>
  <a href="transition_shader.html">transition_shader</a><br>
  <a href="fxaa.html">fxaa</a><br>
  <a href="ssao.html">ssao</a><br>
  <a href="camera_outline_shader.html">camera_outline_shader</a><br>
  <a href="pixelation_shader.html">pixelation_shader</a><br>
  <a href="camera_contrast.html">camera_contrast</a><br>
  <a href="camera_vertical_blur.html">camera_vertical_blur</a><br>
  <a href="camera_grayscale.html">camera_grayscale</a><br>
</div><br>
<script>
function copy_to_clipboard(containerid) {
    var range = document.createRange()
    range.selectNode(containerid)
    window.getSelection().removeAllRanges()
    window.getSelection().addRange(range)
    document.execCommand("copy")
    window.getSelection().removeAllRanges()
}
</script>
<br>
<br>
</body>
</html><style>
h1 {margin-bottom:0em; margin-top:1em}
h2 {margin-bottom:.5em;}
h3 {margin:0em; font-size:1em;}
code_block {margin-top:.0em; margin-bottom:1em;}
hr {border-color:gray; opacity:.25;}
.links {width:fit-content;}
.links a {text-decoration:none; opacity:.5;}
</style>
